// EXAMPLE LUA FILE FOR ACHIEVEMENTS MODULE
// By thomasfn
// Shared

include( "achievements.lua" )
if (SERVER) then 

	AddCSLuaFile( "achievements.lua" ) 
	AddCSLuaFile( "example.lua" )

end

achievements.CreateCategory( "THC" )
achievements.AddCustomHook("PlayerSpawnedSENT")
achievements.AddCustomHook( "PlayerSay" )
achievements.AddCustomHook("PlayerSpawnedProp")
achievements.AddCustomHook("OnPhysgunReload")
achievements.AddCustomHook("PlayerSpray")
achievements.AddCustomHook("PlayerSpawn")
achievements.AddCustomHook("OnPhysgunFreeze")
achievements.AddCustomHook("PlayerUse")
achievements.AddCustomHook("PlayerNoClip")
achievements.AddCustomHook("OnPlayerChangedTeam")
achievements.AddCustomHook("OnDamagedByExplosion")

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Spray your Spray 5 times"
ACH.Image = "gui/silkicons/palette"
ACH.Target = 5
function ACH:PlayerSpray( ply )
		self:AwardPoint( ply )
end
achievements.Register( "THC", "Graffiti Artist", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Respawn 50 times"
ACH.Image = "gui/silkicons/star"
ACH.Target = 50
function ACH:PlayerSpawn( ply, mdl )
                self:AwardPoint( ply )
end
achievements.Register( "THC", "Reincarnation", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Reload Unfreeze 5 contraptions"
ACH.Image = "gui/silkicons/car"
ACH.Target = 5
function ACH:OnPhysgunReload( weapon, ply )
		self:AwardPoint( ply )
end
achievements.Register( "THC", "Brave Unfreezing", ACH )


local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Spawn a prop"
ACH.Image = "gui/silkicons/star"
ACH.Target = 0
function ACH:PlayerSpawnedProp( ply, mdl )
		self:Award( ply )
end
achievements.Register( "THC", "Gold Star For Trying 1", ACH )


local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Spawn 50 Babies"
ACH.Image = "gui/silkicons/car"
ACH.Target = 50
function ACH:PlayerSpawnedProp( ply, mdl )
	if (mdl == "models/props_c17/doll01.mdl") then
		self:AwardPoint( ply )
	end
end
achievements.Register( "THC", "Midwife", ACH )


 
 
local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Freeze 50 objects"
ACH.Image = "gui/silkicons/star"
ACH.Target = 50
function ACH:OnPhysgunFreeze( weapon, physobj, ent, pl )
                self:AwardPoint( pl )
end
achievements.Register( "THC", "A True Eskimo", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Chat a lot using text"
ACH.Image = "gui/silkicons/star"
ACH.Target = 100
function ACH:PlayerSay( ply, text, toall )
                self:AwardPoint( ply )
end
achievements.Register( "THC", "SMT Wannabe", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Use an Object 50 times"
ACH.Image = "gui/silkicons/star"
ACH.Target = 50
function ACH:PlayerUse( ply, mdl )
                self:AwardPoint( ply )
end
achievements.Register( "THC", "Use and Abuse", ACH )
 

 
--[[achievements.AddCustomHook("PlayerCanSeePlayersChat")
local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Recieved 750 lines of chat"
ACH.Image = "gui/silkicons/star"
ACH.Target = 750
function ACH:PlayerCanSeePlayersChat( ply, mdl )
                self:Award( ply )
end
achievements.Register( "THC", "Good listener", ACH )]]
 
 
 
 

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Noclip a 100 times"
ACH.Image = "gui/silkicons/star"
ACH.Target = 100
function ACH:PlayerNoClip( ply )
                self:AwardPoint( ply )
end
achievements.Register( "THC", "Flight Master", ACH )
 
 
 
 
 
achievements.AddCustomHook("GetFallDamage")
local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Jump from a large object"
ACH.Image = "gui/silkicons/star"
ACH.Target = 0
function ACH:GetFallDamage( ply, mdl )
                self:Award( ply )
end
achievements.Register( "THC", "Leap of faith", ACH )
 
 
 
 
achievements.AddCustomHook("PlayerEnteredVehicle")
local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Enter a vehicle"
ACH.Image = "gui/silkicons/star"
ACH.Target = 0
function ACH:PlayerEnteredVehicle( ply, vehicle, role)
                self:Award( ply )
end
achievements.Register( "THC", "All aboard!", ACH )


local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Bitch about errors"
ACH.Image = "gui/silkicons/application"
ACH.Target = 0
function ACH:PlayerSay( ply, text )
	if (string.find(string.lower(text),"error")) then
		self:Award( ply )
	end
end
achievements.Register( "THC", "I See Errors", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Love 5 Things"
ACH.Image = "gui/silkicons/application"
ACH.Target = 5
function ACH:PlayerSay( ply, text )
	if (string.find(string.lower(text),"love")) then
		self:AwardPoint( ply )
	end
end
achievements.Register( "THC", "Bigamy", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Get Demoted :("
ACH.Image = "gui/silkicons/application"
ACH.Target = 0
function ACH:OnPlayerChangedTeam( ply, old, new )
	if (string.lower(old)=="admin" or string.lower(old)=="superadmin" or string.lower(old)=="uberadmin" or string.lower(old)=="owner") then
		self:Award( ply )
	end
end
achievements.Register( "THC", "Demoted", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Get Promoted :)"
ACH.Image = "gui/silkicons/application"
ACH.Target = 0
function ACH:OnPlayerChangedTeam( ply, old, new )
	if (string.lower(new)=="admin" or string.lower(new)=="superadmin" or string.lower(new)=="uberadmin" or string.lower(new)=="owner") then
		self:Award( ply )
	end
end
achievements.Register( "THC", "Promoted", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Love Bombs"
ACH.Image = "gui/silkicons/bomb"
ACH.Target = 50
function ACH:OnDamagedByExplosion( ply, damgeinfo )
		self:AwardPoint( ply )
end
achievements.Register( "THC", "Bomb Squad", ACH )

--[[
local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Spawn a CPU"
ACH.Image = "gui/silkicons/star"
ACH.Target = 0
function ACH:PlayerSpawnedSENT( ply, ent )
	if (ent:GetClass() == "gmod_wire_cpu") then
					self:Award( ply )
	end
end
achievements.Register( "THC", "Gold Star For Trying 4", ACH )



--[[local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Spawn an Expression 1"
ACH.Image = "gui/silkicons/bomb"
ACH.Target = 0
function ACH:PlayerSpawnedSENT( ply, ent )
	if (ent:GetClass() == "gmod_wire_expression") then
					self:Award( ply )
	end
end
achievements.Register( "THC", "Redundant Wiring", ACH )]]


--[[local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Spawn 5 Working Expression 2s"
ACH.Image = "gui/silkicons/emoticon_smile"
ACH.Target = 5
function ACH:PlayerSpawnedSENT( ply, ent )
	if (ent:GetClass() == "gmod_wire_expression2") then
			timer.simple(1.5, function()
				local r,g,b,a = ent:GetColor(); 
				if (g != 0) then
					self:AwardPoint( ply )
				end
			end)
	end
end
achievements.Register( "THC", "I Can Do E2 Me!", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Spawn 5 Broken E2s"
ACH.Image = "gui/silkicons/bomb"
ACH.Target = 5
function ACH:PlayerSpawnedSENT( ply, ent )
	if (ent:GetClass() == "gmod_wire_expression2") then
			timer.simple(1.5, function()
				local r,g,b,a = ent:GetColor(); 
				if (r == 255 and g == 0) then
					self:AwardPoint( ply )
				end
			end)
	end
end
achievements.Register( "THC", "I'm Having a Bad Day 1", ACH )]]


--[[ local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Kill 5 NPCs."
ACH.Image = "gui/silkicons/bomb"
ACH.Target = 5
function ACH:OnKilledNPC( ply, npc )
	self:AwardPoint( ply )
end
achievements.Register( "AI Killing", "AI Killer", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_PROGRESS
ACH.Description = "Kill 10 NPCs."
ACH.Image = "gui/silkicons/bomb"
ACH.Target = 10
function ACH:OnKilledNPC( ply, npc )
	self:AwardPoint( ply )
end
achievements.Register( "AI Killing", "AI Owner", ACH )

local ACH = {}
ACH.Type = ACHIEVEMENT_ONEOFF
ACH.Description = "Play some chess."
ACH.Image = "gui/silkicons/wrench"
ACH.Target = 0
function ACH:PlayerSay( ply, text )
	print( "Player Said:", text )
	if (text == "chess") then
		self:Award( ply )
	end
end
achievements.Register( "#misc", "Chess Play3r", ACH )]]
